//
//  GQProfileContactContrller.m
//  GuQu
//
//  Created by HELIUM STAR on 15/5/29.
//  Copyright (c) 2015年 HELIUM STAR. All rights reserved.
//

#import "GQProfileContactContrller.h"
#import "GQProfileContactCell.h"

@interface GQProfileContactContrller () <UITableViewDataSource, UITableViewDelegate>

@end

@implementation GQProfileContactContrller

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"通讯录";
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageWithOriginalName:@"distribute_back"] style:UIBarButtonItemStylePlain target:self action:@selector(backToPre)];
    
    UISearchBar *searchBar = [[UISearchBar alloc] init];
    [self.view addSubview:searchBar];
    searchBar.barTintColor = [UIColor colorWithRed:240/255.0 green:240/255.0 blue:240/255.0 alpha:1.0];
    searchBar.x = 0;
    searchBar.y = kNavigatationBarHeight;
    searchBar.width = self.view.width;
    searchBar.height = 40;
    searchBar.placeholder = @"搜索通讯录";
    
    UITableView *tableView = [[UITableView alloc] init];
    tableView.x = 0;
    tableView.y = CGRectGetMaxY(searchBar.frame);
    
    tableView.width = self.view.width;
    tableView.height = self.view.height - tableView.y;
    tableView.delegate = self;
    tableView.dataSource = self;
    [self.view addSubview:tableView];
    
}

- (void)backToPre
{
    [self.navigationController popViewControllerAnimated:YES];
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.phoneArr.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    GQProfileContactCell *cell = [tableView dequeueReusableCellWithIdentifier:kFlag];
    if (cell == nil) {
        cell = [[GQProfileContactCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:kFlag];
    }
    cell.phoneInfo = self.phoneArr[indexPath.row];
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 60;
}

@end
